package textfield;

/**
 * Answer.java
 *
 *
 * Created: Sun Jul 25 14:21:57 2010
 *
 * @author <a href="mailto:fred@theseibels.com">Fred Seibel</a>
 * @version 1.0
 */
public class Answer {
    Integer n;
    String text;
    String c;
    String x;
    Answer(Integer n, String text, String c, String x) {
	this.n = n;
	this.text = text;
	this.c = c;
	this.x = x;
    }
    public boolean equals(Object t) {
	Answer a = (Answer) t;
	return n.equals(a.n);
    }

    String getAnswer() {
	try {
	    return Proto.reconstruct.getLine(Integer.valueOf(text).intValue());
	}
	catch (	java.lang.NumberFormatException e) {
	    return text;
	}
    }
    int compareTo(Answer answer) {
	String text1 = getAnswer();
	String text2 = answer.getAnswer();
	return text1.compareTo(text2);
    }

    public String toString() {
	String retval = "A: " +  n  + " " + text;
	return retval;
    }
}	

